package com.dragonsoftbravo.sqlbuilder.sql.sub;

import java.util.Arrays;

import com.dragonsoftbravo.sqlbuilder.sql.Builder;

public class SqlHaving extends Builder implements Having {

	public SqlHaving(StringBuilder sqlBuilder) {
		super(sqlBuilder);
	}

	@Override
	public HavingConst having(String... args) {
		return having(Arrays.asList(args));
	}

	@Override
	public HavingConst having(Iterable<String> args) {
		sqlBuilder.append(" HAVING");
		for (String s : args) {
			sqlBuilder.append(" ").append(s).append(" AND");
		}
		sqlBuilder.delete(sqlBuilder.length() - 4, sqlBuilder.length());
		return new SqlHavingConst(sqlBuilder);
	}

}
